package TUILayer;//makes this class a part of the TUILayer package
import java.util.Scanner;

/**
 * Write a description of class MenuUI here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class MenuUI
{
    // the reference to the ControlLayer
    private OrdreUI ordreUI;//reference to other UI objects
    private KundeUI kundUI;
    private VareUI vareUI;

   public MenuUI()
   {
    
   }
    public void menuStart()
    {
      boolean exit=false;
      while (!exit)
      {
            int choice = writeMenu();
            if(choice == 1)
            {
                startKunde();
            }
            else{
                    if(choice == 2) {
                       startVare();
                    }
                    else{
                        if(choice == 3) {
                            startOrdre();
                        }
                        else{
                            writeEnd();
                            exit = true;
                            }
                    }
          }
      }
   }
   
   private int writeMenu()
   {
       Scanner keyboard = new Scanner(System.in);
       System.out.println("\f *** Menu ***");
       System.out.println(" (1) Kunde");
       System.out.println(" (2) Vare");
       System.out.println(" (3) Ordre");
       System.out.println(" (4) Afslut");
       System.out.print("\n Vælg: ");
            
       int choise = keyboard.nextInt();
            
       return choise;
    }
    
   private void startKunde()
    {
        kundUI= new KundeUI();
        kundUI.start();
        //the kundUI needs to have a reference to the address controller
        //main controller can return references to the other controllers
     
    }
    
   private void startVare()
    {
        vareUI= new VareUI();
        vareUI.start();
        //the vareUI needs to have a reference to the address controller
        //main controller can return references to the other controllers
     
    }
    
    private void startOrdre()
    {
        ordreUI= new OrdreUI();
        ordreUI.start();
        //the ordreUI needs to have a reference to the address controller
        //main controller can return references to the other controllers
     
    }
    
    private void writeEnd()
    {
        System.out.println(" The System is shuting down ");
    }
}
